package test8;

import java.util.Map;

public class AuthNHolder {
    public static void main(String[] args) {

    }

    private static final ThreadLocal<Map<String, String>> loginThreadLocal = new ThreadLocal<>();

    public static void setMap(Map<String, String> map) {
        loginThreadLocal.set(map);
    }

    public static String userId() {
        return get("userId");
    }

    public static String get(String key) {
        Map<String, String> map = getMap();
        return map.get(key);
    }

    public static void clear() {
        loginThreadLocal.remove();
    }

    public static Map<String, String> getMap() {
        return loginThreadLocal.get();
    }
}
